Results 1 to 6 of 6

Thread: Some hurt triggers not working & the "hide" scripting command????

  1. #1

    Default Some hurt triggers not working & the "hide" scripting command????

    G'day I have a large map with many triggers performing different tasks which are all working fine except for three hurt triggers inside a building.
    It's a church tower with a large bell in it. My idea is to prevent snipers from nesting in the tower so I thought to include hurt or damage but only when the bell is rung. Loud sound waves can cause nose bleeds to internal damage depending on distance and volume.
    The three triggers inside the tower have different levels of damage depending on how close to the bell you are when it's rung. The higher you are the more damage the sound waves will cause.
    The bell is activated by another person pulling the rope, located in the church but not in the tower itself.

    Other hurt triggers in the map work perfectly but these three in question require the enter key to be pushed, like "use" triggers do. I even tried remaking them as trigger "multiple" and adding the required damage to them. But they still require you to hit the enter key... for unknown reasons.
    As the church is the central focal point of the map I really want that part to work. So, thinking I had reached a limit, I removed all other triggers from my map and tried remaking the above mentioned methods again to no avail.

    That's just stage one of the problem...

    Because I want the hurt/damage to be triggered by another event (the rope). So when one player triggers the event by pulling the rope from bottom of the tower, I want it to hurt players in the three trigger areas up inside the tower.
    At first I thought to use way points to move the hurt triggers into position when the rope/bell event is activated, then move them out of position again when it's not active. That method seems cumbersome.
    Then I read documents about scripting and found that there is a "hide" command but no mention of "unhide", "reveal", "display" or "show". So I don't know what command works or how to script it.
    I tried to "hide" the triggers then "show" when the event is activated. But I don't think the trigger hid at all. It still activated when I hit the enter key whilst inside the tower.

    I hope that's a little clearer than mud. Any help would be greatly appreciated.

  2. #2

    Default

    I think this is what you're looking for (pull the rope with use trigger, other triggers start acting for a set period of time in a different part of the map)

    Here is my switch (your rope) with a use trigger:

    gas_stuff:
    //
    // Trigger on the wall
    //
    	//Vent Switch Trigger
    	local.lever = spawn trigger_use "targetname" "gas_switch_trigger"
    	local.lever.origin = ( 471 5737 65 ) // position it
    	local.lever setsize ( -8 -8 -8) ( 8 8 8) // give it some size
    	local.lever setthread gas_on
    //
    // Model of trigger on wall
    //
    	local.switch = spawn script_model "targetname" "gas_switch"
    	local.switch model "animate/alarmswitch.tik"
    	local.switch.origin = ( 471 5737 65 )
    	local.switch.angles = ( 0 -90 0 )
    	local.switch.scale = 1
    	local.switch notsolid
    	local.switch anim idleoff
    //
    // Trigger that hurts players when they are touching it
    //
    	//Vent Trigger
    	local.trig = spawn trigger_multiple "targetname" "gas_trigger1"
    	local.trig.origin = ( -2095 5370 -190 ) // position it
    	local.trig setsize ( -1028 -444 -70 ) ( 1028 444 70 ) // give it some size
    	local.trig wait 1 // How often the trig acts
    	local.trig delay 0 // How long before trig acts
    	local.trig setthread gas_hurt
    
    	$gas_trigger1 nottriggerable
    end


    This is the code that handles the animations for my "gas leak"

    gas_on:
    //
    // Announce that the trigger has been activated, turn on the hurt trigger ($gas_hurt1) and stop players from triggering it again until the actions are finished
    //
    
    iprintlnbold "A gas leak has been detected."
    wait 1
    iprintlnbold "Evacuate the Tunnels!"
    $gas_switch_trigger nottriggerable
    
    local.player=parm.other
    
    $gas_switch anim turnon
    $gas_switch playsound flip_switch
    
    $gas_trigger1 triggerable
    
    wait 10
    //
    // The trigger should stop now, so let people flip it again and stop the hurt trigger ($gas_trigger1)
    //
    
    $gas_switch anim turnoff
    $gas_switch playsound flip_switch
    
    $gas_trigger1 nottriggerable
    $gas_switch_trigger triggerable
    iprintlnbold "The gas leak has been fixed."
    
    //
    // Turn off all the animations
    //
    
    $pipe1 remove
    $pipe2 remove
    $pipe3 remove
    $pipe4 remove
    $pipe5 remove
    $pipe6 remove
    $pipe7 remove
    $pipe8 remove
    $pipe9 remove
    $pipe10 remove
    $pipe11 remove
    $pipe12 remove
    
    end


    And the hurt trigger:

    gas_hurt:
    //
    // The actual "hurt"
    //
    
    local.player=parm.other
    
    local.player hurt 8
    
    //
    // All of my animations are below
    //
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe1"
    	$pipe1.origin = ( -1098 4925 -145)
    	$pipe1.angles = ( 15 145 0)
    	$pipe1.scale = 5
    	$pipe1 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe2"
    	$pipe2.origin = ( -1439 5221 -145 )
    	$pipe2.angles = ( 20 -90 0)
    	$pipe2.scale = 5
    	$pipe2 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe3"
    	$pipe3.origin = ( -1643 5160 -245 )
    	$pipe3.angles = ( 0 90 0)
    	$pipe3.scale = 5
    	$pipe3 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe4"
    	$pipe4.origin = ( -1648 5359 -245 )
    	$pipe4.angles = ( 0 18 0)
    	$pipe4.scale = 5
    	$pipe4 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe5"
    	$pipe5.origin = ( -1964 5308 -126 )
    	$pipe5.angles = ( 10 53 0 )
    	$pipe5.scale = 5
    	$pipe5 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe6"
    	$pipe6.origin = ( -1741 5607 -126 )
    	$pipe6.angles = ( 15 -145 0 )
    	$pipe6.scale = 5
    	$pipe6 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe7"
    	$pipe7.origin = ( -2097 5805 -132 )
    	$pipe7.angles = ( 13 -88 0 )
    	$pipe7.scale = 5
    	$pipe7 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe8"
    	$pipe8.origin = ( -2107 5154 -132 )
    	$pipe8.angles = ( 21 88 0 )
    	$pipe8.scale = 5
    	$pipe8 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe9"
    	$pipe9.origin = ( -3108 5500 -132  )
    	$pipe9.angles = ( 22 -22 0 )
    	$pipe9.scale = 5
    	$pipe9 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe10"
    	$pipe10.origin = ( -3014 4979 -132  )
    	$pipe10.angles = ( 22 40 0 )
    	$pipe10.scale = 5
    	$pipe10 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe11"
    	$pipe11.origin = ( -2304 4984 -132  )
    	$pipe11.angles = ( 13 130 0 )
    	$pipe11.scale = 5
    	$pipe11 loopsound steam
    
    	spawn script_models "model" "emitters/pipe_steam.tik" "targetname" "pipe12"
    	$pipe12.origin = ( -2263 5513 -132  )
    	$pipe12.angles = ( 13 -132 0 )
    	$pipe12.scale = 5
    	$pipe12 loopsound steam
    
    	end



    Note that the trigger will not start unless a player is touching it. With my example, if I do not enter the hurt zone, I will not see animations. So when you're testing this - keep that in mind. Hope it helps, let me know if you have any issues!

  3. #3

    Default

    Wow thanks SplatterGuts, but I have just resolved it myself.
    I don't know why I had the three tower triggers set threads but that was stopping the script from going any further.
    As soon as I over-viewed my script today I saw the problem. I hadn't touched it for a few weeks prior to posting this thread.

    I appreciate your efforts and will not put your script to waste. Perhaps in my next map.
    Thank you very much again. Top stuff.

  4. #4
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Hey

    Another way to possible think about this is not with the use of multiple triggers, more just the single rope pull trigger, that once pulled will cause player damage to those who are near the bell, causing different damage depending how close they are to the origin ( the bell );

    I do not no your setup for distances etc, but here is a sample code you can try

    bell_ring local.attacker:
    
        local.radius = 200.00 * 200.00;
        local.origin = (0, 0, 0);
        local.max_damage = 150;
    
        for(local.i = 1; local.i <= $player.size; local.i++)
        {
            local.player= $player[local.i];
            local.distance =  (local.player.origin - local.origin) * (local.player.origin - local.origin);
    
            if(local.distance <= local.radius)
            {
                if(local.player != local.attacker)
                {
                    local.dmg_fact = 1 - local.distance / local.radius;
                    local.dmg = local.max_damage * local.dmg_fact;
                    local.player damage local.attacker local.dmg local.attacker (0 0 0) (0 0 0) (0 0 0) 0 1 15 -1;
                }
            }
    
        }
    
    
    end;

    Now you need to change the local.origin to the position of the bell;
    You can also change the radius and max damage variables, max damage being the most damage the player will receive when standing closest to the bell;

    To run this script, just execute it from the rope pull trigger passing the player who triggered it to the script ( so they get the kills ).

    Example

    thread bell_ring parm.other

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  5. #5

    Default

    BTW, my scripting is way shorter, most of it is just the bell swinging... three gongs then gradual to a stop.

    The rope has two triggers, one for the rope movement (up & down) and one for the bell swinging which includes the hurt or volume damage.

    Code:
    pullrope:
    	$rope time 2.5
    	$rope moveto $ropedown
    	$rope waitmove
    	$rope time 2.5
    	$rope moveto $ropeup
    	$rope waitmove
    end
    $bellshock 1, 2 and 3 are the three multiple triggers in the tower. One being the lowest and 3 being right up next to the bell.

    Code:
    chime:
    	$bell time 2.5
    	$bell rotatezup 16
    	$bell waitmove
    	$bellspeakers1 playsound gong1
    	$bellshock1 volumedamage 5
    	$bellshock2 volumedamage 10
    	$bellshock3 volumedamage 15
    	$bell time 2.5
    	$bell rotatezdown 16
    	$bell waitmove
    	$bell time 2.5
    	$bell rotatezdown 16
    	$bell waitmove
    	$bellspeakers2 playsound gong1
    	$bellshock1 volumedamage 5
    	$bellshock2 volumedamage 10
    	$bellshock3 volumedamage 15
    	$bell time 2.5
    	$bell rotatezup 16
    	$bell waitmove
    	$bell time 2.5
    	$bell rotatezup 16
    	$bell waitmove
    	$bellspeakers1 playsound gong2
    	$bellshock1 volumedamage 5
    	$bellshock2 volumedamage 10
    	$bellshock3 volumedamage 15
    	$bell time 2.5
    	$bell rotatezdown 16
    	$bell waitmove
    	$bell time 2
    	$bell rotatezdown 8
    	$bell waitmove
    	$bell time 2
    	$bell rotatezup 8
    	$bell waitmove
    	$bell time 2
    	$bell rotatezup 4
    	$bell waitmove
    	$bell time 2
    	$bell rotatezdown 4
    	$bell waitmove
    	$bell time 2
    	$bell rotatezdown 2
    	$bell waitmove
    	$bell time 2
    	$bell rotatezup 2
    	$bell waitmove
    end
    Man, I am so relieved. This has stumped me for a few weeks now. I hadn't touched it for the past fortnight.

  6. #6

    Default

    Wow a second solution. Thanks Purp

    Thanks it's great to see how others think ways around the same situation.

    You both make my script look pretty ordinary. lol
    Last edited by AccadaccA; September 23rd, 2016 at 12:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •